package com.dgh.school.controller;

import com.dgh.school.bean.Meeting;
import com.dgh.school.common.R;
import com.dgh.school.service.ClerkService;
import com.dgh.school.service.MeetingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
public class MeetingController {

    @Autowired
    private MeetingService meetingService;


    @RequestMapping("/meeting/show")
    public R selectAllMeeting(int pageNum, int pageSize){
        try{
            return meetingService.selectByPage(pageNum,pageSize);

        } catch (Exception e){
            return R.error();
        }
    }

    @RequestMapping("/meeting/modify")
    public R updateMeeting(Meeting m){
        System.out.println(m.getMName());
        System.out.println(m.getMInfo());
        System.out.println(m.getStartTime());
        try {
            meetingService.updateMeeting(m);
            return R.ok();
        } catch (Exception e) {
            return R.error();
        }
    }

    @RequestMapping("/meeting/delete")
    public R deleteMeeting(int mid){
        System.out.println("mid是什么");
        System.out.println(mid);
        try {
            meetingService.deleteMeeting(mid);
            return R.ok();
        } catch (Exception e) {
            return R.error();
        }
    }
}
